<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<title>修改密码</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<script src="/statics/js/custom/dpstudio.js?_V=1"></script>
<script type="text/javascript" src="/statics/js/apis/admin.js?v=1"></script>

</head>

<body ng-app="">
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    <ng-include src="'/admin/common/sidebar.html'" onload="topSelect = 'home'"></ng-include>
    <!--End 左侧导航-->
    <!--头部信息-->
    <ng-include src="'/admin/common/header.html'"></ng-include>
    <!--End 头部信息-->

    <!--页面主要内容-->
    <main class="lyear-layout-content">
      <div class="container-fluid p-t-15">
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                <form method="post" action="" id="passwordForm">
                  <div class="form-group col-md-12 mx_validator">
                    <label for="old_pwd">旧密码</label>
                    <input type="password" class="form-control mx_required" id="old_pwd" name="oldPassword" mx_required_msg="旧密码不能为空" placeholder="旧密码"/>
                  </div>
                  <div class="form-group col-md-12 mx_validator">
                    <label for="new_pwd">新密码</label>
                    <input type="password" class="form-control mx_required mx_custom" mx_required_msg="新密码不能为空" id="new_pwd" name="newPassword"  placeholder="新密码" />
                  </div>
                  <div class="form-group col-md-12 mx_validator">
                    <label for="confirm_pwd">确认新密码</label>
                    <input type="password" class="form-control mx_required mx_custom" mx_required_msg="确认新密码不能为空" id="confirm_pwd" name="rePassword"  placeholder="确认新密码" />
                  </div>
                  <button type="button" class="btn btn-primary mx_validator_button" id="submit">保存</button>
                </form>

              </div>
            </div>
          </div>

        </div>
      </div>
    </main>
    <!--End 页面主要内容-->
  </div>
</div>




<script type="text/javascript">
  $(function () {
    $("#submit").click(function(){

      VALIDATE.validate($("#passwordForm"),ADMIN_UPDATE_PASSWORD,function(dom){
        var result = {
          "retBool": false,
          "msg": ""
        };
        var data = FORM.getValues($("#passwordForm"));
        if(data.newPassword !== data.rePassword){
          result = {
            "retBool": true,
            "msg": "两次密码输入不一致"
          };
        }
        return result;
      },null,function(e){
        if (e.code === "00000") {
          MX.successMsg("修改成功~")
          setTimeout(function(){
            Token.remove();
            window.location.href = LOGIN_VIEW;
          },1000)
        } else {
          $(".mx_validator_button").attr("disabled",false)
          MX.failMsg(e.msg != null ? e.msg : "修改失败")
        }
      })
    });
  });


</script>
</body>
</html>
